<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>列表</title>
    <script src="../../js/vue.js"></script>
</head>
<body>
    <div id="root">
        <form @submit.prevent="sub">
            账号 : 
            <input id="account" type="text" v-model.trim="userInfo.account">
            <br><br>
   
            密码 :
            <input id="password" type="password" v-model="userInfo.password">
            <br><br>

            年龄 :
            <input id="number" type="number" v-model.number="userInfo.number">
            <br><br>

            性别 :
            男<input type="radio" name="sex" v-model="userInfo.sex" value="man">
            女<input type="radio" name="sex" v-model="userInfo.sex" value="woman">
            <br><br>

            爱好 :
            学习<input type="checkbox" name="hobby" v-model="userInfo.hobby" value="study">
            旅游<input type="checkbox" name="hobby" v-model="userInfo.hobby" value="travel">
            吃  <input type="checkbox" name="hobby" v-model="userInfo.hobby" value="eat">
            <br><br>
            
            所属小区 :
            <select id="community" v-model='userInfo.community'>
                <option value="">选择小区</option>
                <option value="ouyun">欧韵</option>
                <option value="xiefang">谢坊</option>
                <option value="tuoli">坨里</option>
            </select>
            <br><br>

            其他 
            <textarea id="other" v-model.lazy='userInfo.other'></textarea>
            <br><br>

             用户协议 
            <input id="xieyi" type="checkbox" v-model="userInfo.agree"><a>《用户协议》</a>
            <br><br>

            <button>提交</button>
            <br><br>

        </form>
        
    </div>

    <script>
        Vue.config.productionTip = false;
        new Vue({
            el: '#root',
            data: {
                userInfo:{
                    account: '',
                    password: '',
                    sex:'man',
                    hobby:[],
                    community:'',
                    other:'',
                    agree:''
                }
                
            },
            methods: {
                sub(){
                    // const subDataJson = JSON.stringify(this._data);
                    const subDataJson = JSON.stringify(this.userInfo);
                    console.log(subDataJson)
                }
            }
        })
    </script>

</body>
</html>